# $Id: PKGBUILD 179700 2013-03-09 11:48:07Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Eugeni Dodonov <eugeni@dodonov.net>

pkgname=glamor-egl
pkgver=0.5.0
pkgrel=4
pkgdesc='OpenGL based 2D rendering acceleration library	'
arch=('i686' 'x86_64')
url="http://xorg.freedesktop.org/"
license=('custom')
depends=('mesa-libgl')
makedepends=('xorg-server-devel')
source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
        glamor_utils.h glamor_priv.h glapi.h
        compat-api.h compiler.h glamor_debug.h glamor_gl_dispatch.h glamor_glext.h
        git-fixes.patch)
conflicts=('glamor-git')
options=('!libtool')
sha256sums=('5dc8679ccb3e42bf431b6316c7907b9df2db89745d523e04721f34aee6c84991'
            'fb7db610451d8bb0baaabe3ac618794f535924ac08f62159b08a82ac90a1ed4a'
            '6ad1b6349325be84aa9fe6f0b3224128f11bcf00a91a7080e40cd7b58a83137c'
            '5c148a18607f94fcdfebe2838aa77d190cb913e05579a9676c2520219a5e2a6a'
            '1a5c1059a3757047de064ccd952ab637b73e7e2d55cbccd6dafc60b57aaed1d0'
            'f883c329e7ec94afafa646b866eaab8a5616761b5ffe2b2837c75d403917944a'
            'fc3d937f2cb996586d3a9cc7427050d04d2d19d3f745055cc9d3556428a7cf93'
            'a7fac65474af636995d0181dbf7f8f091d8657260162eb172ae816b75ad98b54'
            'dcf38a7ac303c1636a3b1b7810dcb6ee65ba7e81b6e590840e164ce0e28010dc'
            'c56e677456fb8555b009b1d3b95e939b5a38f37c2a345fff48f2b723e44045e9')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  
  # add missing headers - tarball creation buggy
  cp $srcdir/*.h src/

  patch -Np1 -i ${srcdir}/git-fixes.patch

  autoreconf -vfi

  ./configure --prefix=/usr \
    --disable-static \
    --enable-glx-tls \
    #--with-xorg-conf-dir=/etc/X11/xorg.conf.d

    #--help
    #--enable-glamor-gles2 \ https://bugs.archlinux.org/task/34284
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make "DESTDIR=${pkgdir}" install
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
  
  # hack for lib loading with recent Xorg-servers, see FS#34236  and
  # http://lists.x.org/archives/xorg-devel/2013-March/035719.html
  
  # add glamor library path to ld.so.conf.d
#  install -d ${pkgdir}/etc/ld.so.conf.d
#  echo "/usr/lib/xorg/modules" > ${pkgdir}/etc/ld.so.conf.d/${pkgname}.conf
}
